<template>
  <div id="allocate-management" class="component-wrap">
    <Title :title-msg="titleMsg"></Title>
    <Select :select-length="selectLength"></Select>
    <div class="allocate-list">
      <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
        <Box v-for="(item,index) in allocateLists" :key="index" :item="item"></Box>
      </van-pull-refresh>
    </div>
    <img src="../../assets/ic_add@3x.png" class="add"/>
  </div>
</template>

<script type="text/ecmascript-6">
  import Title from '@/components/common/Title.vue'
  import Select from '@/components/common/Select.vue'
  import Box from '@/components/common/AllocateBox.vue'
  import { PullRefresh } from 'vant';

  const list = {
    "exportTime": "2019-03-15",
    "exportOrganization": "青岛海信智慧家居",
    "exportAdmin": "王建成",
    "importOrganization": "青岛聚好联科技有限公司",
    "exportAdmin": "李晓明",
    "remark": "按时处理",
    "allocateNum": "09198 120 232382",
    "status": "已确认"
  }
  const list1 = {
    "exportTime": "2019-03-15",
    "exportOrganization": "青岛海信智慧家居",
    "exportAdmin": "王建成",
    "importOrganization": "青岛聚好联科技有限公司",
    "exportAdmin": "李晓明",
    "remark": "按时处理",
    "allocateNum": "09198 120 232382",
    "status": "已驳回"
  }

  export default {
    name: "allocateManagement",
    data:function(){
      return {
        allocateLists: [ list, list1, list, list1 ],
        titleMsg: {
          title: "资产调拨单",
          back: true,
          scan: false,
          search: true
        },
        isLoading: false
      }
    },
    computed: {
      selectLength:function(){
        return this.allocateLists.length
      }
    },
    methods: {
      onRefresh:function() {
        setTimeout(() => {
          this.$toast('刷新成功');
          this.isLoading = false;
        }, 500);
      }
    },
    components: {
      Title: Title,
      Select: Select,
      Box: Box
    }
  }
</script>

<style scoped>
  #allocate-management .allocate-list {
    position: fixed;
    top: 9.5rem;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
  }
</style>
